/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.io.*;
import java.net.*;

/**
 *
 * @author PeSu
 */
public class convertHTML {

    
    public static String readPage(String url) {
        try {
            URL u = new URL(url);
            HttpURLConnection con = (HttpURLConnection) u.openConnection();
            BufferedReader br = new BufferedReader( new InputStreamReader(
                u.openStream(), "UTF-8"));
            //InputStream is = con.getInputStream();
            String s = "";
        while (true) {
            String str = br.readLine();
            if (str == null) {
                break;
            } else {
                s += str + "\n";
            }
        }
        br.close();

           
            //File f = new File("text.html");
            BufferedWriter bw = new BufferedWriter(
            new OutputStreamWriter(
            new FileOutputStream("text.html"), "UTF-8"));
            bw.write(s);
            bw.close();
            return s;
        } catch (Exception ex) {
            return "";
        }
    }

   
}
